import request from '@/request/request'

// 获取预收付款列表
export function getAdvanceReceiptList(params) {
  return request({
    url: '/finance/advanceReceiptBill/list',
    method: 'get',
    params
  })
}

// 获取预收付款详情
export function getAdvanceReceiptDetail(id) {
  return request({
    url: `/finance/advanceReceiptBill/detail/${id}`,
    method: 'get'
  })
}

// 新增预收付款
export function addAdvanceReceipt(data) {
  return request({
    url: '/finance/advanceReceiptBill/add',
    method: 'post',
    data
  })
}

// 修改预收付款
export function updateAdvanceReceipt(data) {
  return request({
    url: '/finance/advanceReceiptBill/update',
    method: 'put',
    data
  })
}

// 删除预收付款
export function deleteAdvanceReceipt(id) {
  return request({
    url: `/finance/advanceReceiptBill/delete/${id}`,
    method: 'delete'
  })
}

// 批量删除预收付款
export function batchDeleteAdvanceReceipt(ids) {
  return request({
    url: '/finance/advanceReceiptBill/batchDelete',
    method: 'delete',
    data: { ids }
  })
}

// 审核预收付款
export function approveAdvanceReceipt(id) {
  return request({
    url: `/finance/advanceReceiptBill/approve/${id}`,
    method: 'put'
  })
}

// 批量审核预收付款
export function batchApproveAdvanceReceipt(ids) {
  return request({
    url: '/finance/advanceReceiptBill/batchApprove',
    method: 'put',
    data: { ids }
  })
}

// 导出预收付款
export function exportAdvanceReceipt(params) {
  return request({
    url: '/finance/advanceReceiptBill/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 获取预收付款统计
export function getAdvanceReceiptStats(params) {
  return request({
    url: '/finance/advanceReceiptBill/stats',
    method: 'get',
    params
  })
} 